﻿$(function() {
    $("#menu").find("li").each(function() {
	$(this).addClass(getAnimate(1, 1)).show();
	$(this).mouseover(function() {
	    $(this).removeClass().addClass(getAnimate(0, 0)).show();
	}).mouseleave(function() {
	    $(this).removeClass();
	});
    });
    $(".login").addClass(getAnimate(1, 1)).show();
    $(".box").addClass(getAnimate(1, 1)).show();
    $(".box").find("h1").addClass(getAnimate(1, 1)).show();
    $(".box").find(".content").addClass(getAnimate(1, 1)).show();
    $(".back").attr("href", "index.to");
});
/* 将animate.min.css中所有动作（强调、移入、移出）存储到二维数组中 */
var animate = new Array("attent", "in", "out");
animate[0] = new Array("bounce", "headShake", "flash", "jello", "pulse",
	"rubberBand", "shake", "swing", "tada", "wobble", "flip");
animate[1] = new Array("bounceIn", "bounceInUp", "bounceInDown",
	"bounceInLeft", "bounceInRight", "fadeIn", "fadeInUp", "fadeInUpBig",
	"fadeInDown", "fadeInDownBig", "fadeInLeft", "fadeInLeftBig",
	"fadeInRight", "fadeInRightBig", "flipInX", "flipInY", "lightSpeedIn",
	"rollIn", "rotateIn", "rotateInUpLeft", "rotateInDownLeft",
	"rotateInUpRight", "rotateInDownRight", "slideInUp", "slideInDown",
	"slideInLeft", "slideInRight", "zoomIn", "zoomInUp", "zoomInDown",
	"zoomInLeft", "zoomInRight");
animate[2] = new Array("bounceOut", "bounceOutUp", "bounceOutDown",
	"bounceOutLeft", "bounceOutRight", "fadeOut", "fadeOutUp",
	"fadeOutUpBig", "fadeOutDown", "fadeOutDownBig", "fadeOutLeft",
	"fadeOutLeftBig", "fadeOutRight", "fadeOutRightBig", "flipOutX",
	"flipOutY", "hinge", "lightSpeedOut", "rollOut", "rotateOut",
	"rotateOutUpLeft", "rotateOutDownLeft", "rotateOutUpRight",
	"rotateOutDownRight", "slideOutUp", "slideOutDown", "slideOutLeft",
	"slideOutRight", "zoomOut ", "zoomOutUp", "zoomOutDown", "zoomOutLeft",
	"zoomOutRight");
/* 给定第一个下标和随机生成第二个下标（i=0为无限循环，其他为单次），返回完整的动作类名 */
function getAnimate(x, i) {
    var y = parseInt(Math.random() * (animate[x].length - 1));
    var z = ((i == 0) ? "infinite " : "");
    return "animated " + z + animate[x][y];
}
/* 表格初始化：单双行区分颜色 */
function tableInit() {
    $("#datalist tr:odd").css("background-color", "#fff");
    $("#datalist tr:even").css("background-color", "#eee");
}